import { RouteRecordRaw } from 'vue-router'

// 导入页面组件
import Home from '../views/Home.vue'
import Appointment from '../views/Appointment.vue'
import AiDoctor from '../views/AiDoctor.vue'
import Guide from '../views/Guide.vue'
import About from '../views/About.vue'
import News from '../views/News.vue'
import Dashboard from '../views/admin/Dashboard.vue'
import DefaultLayout from '@/layouts/DefaultLayout.vue'
import AdminLayout from '@/layouts/AdminLayout.vue'
import PatientList from '../views/admin/patient/PatientList.vue'
import SysUserList from '../views/admin/sysUser/SysUserList.vue'

const routes: RouteRecordRaw[] = [
  {
    path: '/',
    component: DefaultLayout,
    children: [
      { path: '', name: 'Home', component: Home },
      { path: 'appointment', name: 'Appointment', component: Appointment },
      { path: 'aiDoctor', name: 'AiDoctor', component: AiDoctor },
      { path: 'guide', name: 'Guide', component: Guide },
      { path: 'about', name: 'About', component: About },
      { path: 'news', name: 'News', component: News },
      { path: 'profile', name: 'UserSettings', component: () => import('../views/UserSettings.vue') },
      { path: 'records', name: 'MedicalRecords', component: () => import('../views/MedicalRecords.vue') },
      { path: 'appointments', name: 'MyAppointments', component: () => import('../views/MyAppointments.vue') },
      { path: 'pay-order', name: 'PayOrder', component: () => import('../views/PayOrder.vue') }
    ]
  },
  {
    path: '/admin',
    component: AdminLayout,
    children: [
      {
        path: '',
        name: 'AdminDashboard',
        component: Dashboard,
        meta: { title: '控制面板', icon: 'fas fa-home' }
      },
      {
        path: 'sysUser',
        component: () => import('@/layouts/SysUserLayout.vue'),
        meta: { title: '用户管理', icon: 'fas fa-user-injured' },
        children: [
          {
            path: 'list',
            name: 'SysUserList',
            component: SysUserList,
            meta: { title: '用户列表', icon: 'fas fa-list' }
          },
          {
            path: ':id',
            name: 'PatientDetail',
            component: () => import('@/views/admin/patient/PatientDetail.vue'),
            meta: { title: '用户详情' }
          }
        ]
      },
      {
        path: 'patient',
        component: () => import('@/layouts/PatientLayout.vue'),
        meta: { title: '患者管理', icon: 'fas fa-user-injured' },
        children: [
          {
            path: 'list',
            name: 'PatientList',
            component: PatientList,
            meta: { title: '患者列表', icon: 'fas fa-list' }
          },
          {
            path: ':id',
            name: 'PatientDetail',
            component: () => import('@/views/admin/patient/PatientDetail.vue'),
            meta: { title: '患者详情' }
          }
        ]
      },
      {
        path: 'doctor',
        component: () => import('@/layouts/DoctorLayout.vue'),
        meta: { title: '医生管理', icon: 'fas fa-user-md' },
        children: [
          {
            path: 'list',
            name: 'DoctorList',
            component: () => import('../views/admin/doctor/DoctorList.vue'),
            meta: { title: '医生列表', icon: 'fas fa-list' }
          },
          {
            path: 'schedule',
            name: 'DoctorSchedule',
            component: () => import('@/views/admin/doctor/DoctorSchedule.vue'),
            meta: { title: '排班管理', icon: 'fas fa-calendar-alt' }
          },
          {
            path: ':id',
            name: 'DoctorDetail',
            component: () => import('../views/admin/doctor/DoctorDetail.vue'),
            meta: { title: '医生详情' }
          }
        ]
      },
      {
        path: 'department',
        component: () => import('@/layouts/DepartmentLayout.vue'),
        meta: { title: '科室管理', icon: 'fas fa-clinic-medical' },
        children: [
          {
            path: 'info',
            name: 'DepartmentInfo',
            component: () => import('@/views/admin/department/DepartmentInfo.vue'),
            meta: { title: '科室信息', icon: 'fas fa-info-circle' }
          }
        ]
      },
      {
        path: 'appointment',
        component: () => import('@/layouts/AppointmentLayout.vue'),
        meta: { title: '预约管理', icon: 'fas fa-calendar' },
        children: [
          {
            path: 'query',
            name: 'AppointmentQuery',
            component: () => import('@/views/admin/appointment/AppointmentQuery.vue'),
            meta: { title: '预约查询', icon: 'fas fa-search' }
          }
        ]
      },
      {
        path: 'analytics',
        component: () => import('@/layouts/AnalyticsLayout.vue'),
        meta: { title: '数据分析', icon: 'fas fa-chart-line' },
        children: [
          {
            path: 'dashboard',
            name: 'AnalyticsDashboard',
            component: () => import('@/views/admin/analytics/Dashboard.vue'),
            meta: { title: '数据大屏', icon: 'fas fa-chart-bar' }
          }
        ]
      }
    ]
  },
  {
    path: '/admin/login',
    component: () => import('@/views/admin/AdminLogin.vue')
  },
  {
    path: '/:pathMatch(.*)*',
    name: 'NotFound',
    component: () => import('@/views/NotFound.vue')
  }
]

export default routes
